home *** CD-ROM | disk | FTP | other *** search
/ Just Call Me Internet / Just Call Me Internet.iso / com / bbs / server / hell99_3 / docs / scripts.hlp < prev    next >
Encoding:
Text File  |  1996-07-10  |  9.3 KB  |  319 lines

  1.                         HELL'S BBS SCRIPT LANGUAGE
  2.  
  3. CONTENT:
  4.  
  5. 1) INTRODUCTION
  6. 2) COMMANDS
  7. 3) FUNCTIONS
  8. 4) EXAMPLES
  9. 5) PREDEFINED VARS
  10. 6) EBNF
  11.  
  12.  
  13.  
  14.  
  15. --------------------------------------------------------------------------
  16. 1)
  17. INTRODUCTION:
  18. -------------
  19.  
  20. For all freaks: There is some kind of EBNF at the end of this file...
  21.  
  22. Attention: This script-language is just intended to allow people to make
  23. some additional BBS functions. It is VERY slow, due to the fact it was
  24. written 100% in GfA-basic. But on the other side, it offers some stuff
  25. you have NEVER seen in any other programming language.
  26.  
  27. 1. No difference between numbers and strings. -> Calculate with strings!
  28. 2. You can CALCULATE a string. The string may even contain script-vars!!
  29. 3. Commands to to handle all modem in/output, files/mail/boards...
  30.  
  31. Possible examples for scripts:
  32.  
  33. - Alternative connect-sequence to detect fax/voice
  34. - Make list of best up/downloaders
  35. - vote about something
  36. - setup of different user classes with level/quota/areas...
  37. - little games..
  38. - Much more... just use your imagination...
  39.  
  40. --------------------------------------------------------------------------
  41. 2)
  42. COMMANDS:
  43. ---------
  44.  
  45. Syntax: COMMAND [var] [,var]
  46.  
  47.  
  48. SET varname,var        [Puts anything into varname
  49. varname=var        [Is exactly the same as SET
  50. set var,"text"        [Put "text" into var. I prefer var="text"
  51. var="anytext"        [Content of var is a text ("anytext")
  52. var="x^2+y^2"        [Content of var is an expression (same as text)
  53. var=x^2+y^2        [Content of var is the result of the expression
  54.  
  55. PRINT var [,var]     [Displays data to the screen, with [cr][lf] at end
  56. SEND var [,var]      [Displays data to the screen.
  57. PRINT "Your level: ",l  [Example. Output: Your level: 0
  58.  
  59.  
  60. INPUT var,varname[,var] [Read string from user. [,maxlength] default 60
  61. INPUT "Your age: ",a,2    [Read input with max. lenth 2 and put result in a
  62.  
  63. IF (expression) AND|OR (expression)   [Conditional branch
  64. ELSE
  65. ENDIF
  66. IF (a*2<b*3) AND (c=3)    [Example
  67.             [ Go here, if true
  68. ELSE
  69.             [ Go here if false...
  70. ENDIF
  71.  
  72. REPEAT            [Repeat commands until expression is true
  73. UNTIL expression
  74.  
  75. WHILE expression    [Repeat commands AS LONG as expression true is
  76. WEND
  77.  
  78. DO            [Endless loop. EXIT or EXIF statement NEEDED!
  79. LOOP
  80.  
  81. EXIT            [Leaves a structure immediately. (ALSO IF/ENDIF!)
  82. EXIF expression        [Leaves a structure if expression is true
  83.  
  84. CALC var,varname    [Calculates an expression->result in varname
  85. CALC "a*2/b",res    [Example, put result of a*2/b into res
  86.  
  87. CURSORPOS var,var    [Positionates the graphics-cursor at var,var=x,y
  88.  
  89. SAVECURSOR        [Saves position of the cursor
  90. RESTORECURSOR        [Restores the saved position of the cursor
  91.  
  92. TEXTCOLOR var        [Sets the color of the text (0-7)
  93. BACKCOLOR var        [Sets the color of the background (0-7)
  94. TEXTSTATUS var        [Sets the type of text. (0-7)
  95.  
  96. USERFIND var,varname    [Finds the number of a user -> result in varname
  97. USERFIND "NAME",number  [Example
  98.  
  99. GETUSER1 var [,var]    [Gets name and [number] of the first user
  100. GETNUSER var [,var]    [Gets name and [number] of the next user
  101.  
  102. USERGET var,var,varname [Gets any entry in the user-file
  103. USERGET "SYSOP","LEVEL",lev    [Example... Reads the entry "LEVEL"
  104.  [from the user-file of SYSOP and puts it into lev. You can use the
  105.  [user-number instead of the name to speed up the operation.
  106.  
  107. USERSET var,var,var     [Same as USERGET, but SETS the entry!
  108.  
  109. GETFLOPTOP varname    [This command will find the best up/downloaders 
  110.                             [and put the result in varname(1-20) (Uppers 
  111.                             [in varname(1-10) and downers in varname(11-20)
  112. GETFLOPTOP best        [Example: up: best(1)...best(10) down: 11...20
  113.  
  114. FILEPRINT var        [Prints the (ansi) file var to the screen
  115. %var            [Same, for use in MENUS.BBS file...
  116.  
  117. FILEPAGE var        [Displays a text-file var in pages!
  118. $var            [Same, for use in MENUS.BBS
  119.  
  120. PATH var        [Sets the file-path var
  121. >var            [Same, for use in MENUS.BBS
  122.  
  123. INC varname        [Increments var by 1
  124. DEC varname        [Decrements var by 1
  125.  
  126. COMMAND var [,var]    [Executes internal functions, defined by numbers
  127.             [See MENUS.BBS for examples
  128.  
  129. INTERNAL var        [Executes a command-line like in MENUS.BBS
  130.             
  131. LOGIN            [Executes the login routine. Only for LOGIN.SCR
  132.  
  133. PAUSE var        [Simply pauses var/50 seconds.
  134.  
  135. SCAN varname        [Scans keyboard for input [ max 1 char in var
  136. LOCALSCAN varname    [Scan ONLY local keyboard at BBS! max 1 char
  137. REMOTESCAN varname    [Scan ONLY remote keyboard! max 1000 chars!!
  138.  
  139. CODE var,varname    [Encodes a password var [ result in varname
  140.  
  141. CLS            [Clears the screen
  142.  
  143. MAIL var,var,var[,var]  [Send a private mail
  144. MAIL "from","to","text","subject"  [Example
  145.  
  146. EXEC var,var,var    [Execute a TOS binary program
  147. EXEC "file","com","env" [Example
  148.  
  149. WRITEFILE var,varname    [Put the content of varname into file var
  150. WRITEFILE "file",data   [Example
  151. READFILE var,varname    [Read file var into varname
  152. READFILE "file",var    [Example
  153.  
  154. MIDSET varname,var,var,var [Puts string into var at special position
  155. MIDSET a,pos,"anything",length [Example
  156.  
  157. KILLBUFF        [Erases the input-buffer
  158.  
  159. UNIXMAIL var        [Includes a unix mail-file, also newsgroups!
  160.  
  161. KILL var        [Erases a file
  162.  
  163. TERMINATE        [The BBS program just terminates!!
  164. REBOOT            [Makes the computer reboot! (reset)
  165.  
  166. HANGUP            [Breaks the line and updates the user
  167.  
  168. UPDATEUSER        [Updates all informations of the actual user
  169.  
  170. ECHO ON|OFF|HIDDEN    [Change input display normal/none/as stars
  171.  
  172. LOCALECHO ON|OFF|ONLY    [Change local echo of BBS
  173.  
  174. CARRCHECK ON|OFF    [Toggle general carrier-check
  175.  
  176. SETDTR            [Set Data Terminal Ready
  177.  
  178. DROPDTR            [Drop Data Terminal Ready
  179.  
  180. ----------------------------------------------------------------------
  181. ----3)
  182. FUNCTIONS:
  183. ----------
  184.  
  185. A function always returns a value, so put it in a var: ret=FUNCTION(var)
  186.  
  187. DECIDE(var)        [Execute question in TEXTS.BBS (number var)
  188. CALC(var)        [Calculate any expression, even vars in strings!
  189. UPPER(var)        [Upper cases of any text
  190. LEFT(var,var)        [Left part of var LEFT(var,len)
  191. RIGHT(var,var)        [Right part of var LEFT(var,len)
  192. MID(var,var,var)    [Special part of var MID(var,start,len)
  193. JOIN(var,var [,var])    [Join different vars, treat them as strings!
  194. TEXT(var)        [Return text defined in TEXTS.BBS (number var)
  195. CHR(var)        [Return char of ASCII value
  196. ASC(var)        [Return ASCII valueof first char
  197. LEN(var)        [Return lenght of var
  198. SPACE(var)        [Return a space-string of lenght var
  199. STRING(var,var)        [STRING(len,char) string of char with lenght len
  200. RANDOM(var)        [Return random number between 0 and var-1
  201. EXIST(var)        [Check existence of file. -1=exists 0=not found
  202. SIN(var) COS(var) TAN(var) SQR(var) ....    [Various math. functions
  203.  
  204. --------------------------------------------------------------------------
  205. 4)
  206. EXAMPLES:
  207. ---------
  208.  
  209. 4.1) Maths
  210. ----------
  211.  
  212. input "enter a function f(x,y) a.e sqr(x^2+y^2): ",func,20
  213. input "enter x: ",x
  214. input "enter y: ",y
  215. print "Result: ",calc(func)
  216.  
  217. 4.2) Example login script
  218. -------------------------
  219.  
  220. fileprint "login.ans"
  221.  
  222. print
  223. print "News: blablabla"
  224.  
  225. login            [Execute login routine!
  226.  
  227. mfile="lanliker"
  228.  
  229. path infopath
  230. if exist(mfile)=-1
  231.  unixmail mfile     [Include unix-mailfile if present
  232.  kill mfile        [Erase it then....
  233. endif
  234.  
  235. command 1        [ check for new mail... (System-command number 1)
  236.  
  237. 4.3) An example terminal
  238. ------------------------
  239.  
  240. cls
  241. localecho only            [Do not send to modem
  242. print "Just type ### to quit"
  243. carrcheck off                   [Send without carrier-check
  244. rb="   "
  245. do
  246.     localscan lk        [Scan local keyboard
  247.     if lk<>""        [If input present
  248.         localecho off    [Send to modem, but not to screen!
  249.         send lk        
  250.         localecho only
  251.         rb=lk+left(rb,2) [Check for escape sequence...
  252.     endif
  253.     exif rb="###"        [Leave after escape sequence
  254.     do
  255.         remotescan rk    [Try to read data from the modem
  256.         exif rk=""    [as long we can...
  257.         send rk        [print to screen (localecho only)
  258.     loop
  259. loop
  260. localecho on
  261. carrcheck on
  262.  
  263. --------------------------------------------------------------------------
  264. 5)
  265. PREDEFINED VARS:
  266. ----------------
  267.  
  268. Some vars you can read, but should not set:
  269. This list is not complete, additional vars will follow...
  270.  
  271. LASTDATE    ->Date of previous login of user
  272. LASTTIME    ->Time on LASTDATE of previous login of user
  273. ACALL        ->Number of calls from user
  274. USER        ->Name of actual user
  275. TIME        ->Actual time
  276. DATE        ->Actual date
  277. TIMER        ->200Hz timer
  278. MAINPATH    ->Path of actual language-folder
  279. INFOPATH    ->Path of start-system-files
  280. HELLDRIVE    ->Driver where all BBS-system-data is
  281. CARRIER    ->If carrier is present: 1 else 0
  282. RING        ->If there is a ring at modem: 1 else 0 
  283.  
  284.  
  285. --------------------------------------------------------------------------
  286. 6)
  287. EBNF:
  288. -----
  289.  
  290. SOME KIND OF EBNF FOR THE PEOPLE WHO NEED IT (OR THINK THEY NEED IT) :
  291. If you find any mistake in this EBNF, be proud and go drink a beer!
  292.  
  293. COMMAND [var] [,var]
  294.                               
  295. var          : varname | string
  296.  
  297. string       : ( text | expression | function ) [ + string]
  298.  
  299. expression   : factor ["/" | "*" factor]
  300.  
  301. factor         : ( number ["-" | "+" number] ) | "("expression")"
  302.  
  303. number       : realnumber | var | function | string
  304.  
  305. function     : functionname"("var [,var]")"
  306.  
  307. realnumber   : inumber ["." inumber]
  308.  
  309. inumber      : snumber [snumber]
  310.  
  311. snumber      : "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"
  312.  
  313. text         : "ANY_CHAR_YOU_CAN_TYPE" [text]                
  314.  
  315. varname      : text [inumber] ["("expression")"]
  316. functionname : text
  317.  
  318. --------------------------------------------------------------------------
  319.